﻿Imports System.Collections.ObjectModel
Imports FL_8x0.Common
Imports GalaSoft.MvvmLight

Namespace FL_8x0.FL_800.Model

    Public Class MachineModel
        Inherits ViewModelBase
        Public Property ModelList() = New ObservableCollection(Of String) From {SystemData.Model_800, SystemData.Model_800MS}

        Private _versionList As ObservableCollection(Of String)
        Private _modeList As ObservableCollection(Of String)
        Private _model As String
        Private _version As String
        Private _versionVisibility As Visibility
        Private _portName As String
        Private _baudRate As String
        Private _mode As String


        Public Property Model() As String
            Get
                Return _model
            End Get
            Set(ByVal value As String)
                If _model <> value Then
                    Select Case value
                        Case SystemData.Model_800
                            Version = ""
                            VersionList = SystemData.Versions_800
                            VersionVisibility = Visibility.Visible
                            Mode = ""
                            ModeList = SystemData.Modes_800
                        Case SystemData.Model_800MS
                            Version = ""
                            VersionVisibility = Visibility.Collapsed
                            Mode = ""
                            ModeList = SystemData.Modes_800MS
                    End Select
                    _model = value
                    RaisePropertyChanged()
                End If
            End Set
        End Property

        Public Property Version() As String
            Get
                Return _version
            End Get
            Set(ByVal value As String)
                _version = value
            End Set
        End Property

        Public Property PortName() As String
            Get
                Return _portName
            End Get
            Set(ByVal value As String)
                _portName = value
            End Set
        End Property

        Public Property BaudRate() As String
            Get
                Return _baudRate
            End Get
            Set(ByVal value As String)
                _baudRate = value
            End Set
        End Property

        Public Property Mode() As String
            Get
                Return _mode
            End Get
            Set(ByVal value As String)
                _mode = value
            End Set
        End Property

        Public Property VersionList As ObservableCollection(Of String)
            Get
                Return _versionList
            End Get
            Set(value As ObservableCollection(Of String))
                _versionList = value
                RaisePropertyChanged()
            End Set
        End Property

        Public Property VersionVisibility As Visibility
            Get
                Return _versionVisibility
            End Get
            Set(value As Visibility)
                _versionVisibility = value
                RaisePropertyChanged()
            End Set
        End Property

        Public Property ModeList As ObservableCollection(Of String)
            Get
                Return _modeList
            End Get
            Set(value As ObservableCollection(Of String))
                _modeList = value
                RaisePropertyChanged()
            End Set
        End Property
    End Class
End Namespace